var server = require('../../../utils/server');

Page({
  data: {
    list:[],
  },
  onLoad: function (options) {
    var that = this;
    server.postJSON("/Activity/promoteList",{},function(e){
      that.setData({
        list: e.data.goodsList,
        banner: e.data.brandList
      })
      console.log(e)
    })
  },
  onReachBottom: function () {
    // if (!keywords)
    //   this.getGoods(categoryId, ++cPage, gsort + "-" + asc);
    // else
    //   this.getGoodsByKeywords(keywords, ++cPage, gsort + "-" + asc);
    // wx.showToast({
    //   title: '加载中',
    //   icon: 'loading'
    // })
  },
  onPullDownRefresh: function () {
    this.setData({
      goods: []
    });
    cPage = 0;
    if (!keywords)
      this.getGoods(categoryId, cPage, gsort + "-" + asc);
    else
      this.getGoodsByKeywords(keywords, cPage, gsort + "-" + asc);
  },
  tapGoods: function (e) {
    var objectId = e.currentTarget.dataset.objectId;
    wx.navigateTo({
      url: "/pages/goods/promoteDetail/index?objectId=" + objectId
    });
  },
});